package com.example.homework1.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Random;

@RestController
public class HelloController {

    @GetMapping("/hello")
    public String sayHello() {

        return "Hello World";
    }


    @GetMapping("/random")
    public int random() {

        Random random = new Random();
        return random.nextInt(1000);
    }

    @GetMapping("/square/number")
    public int square(@PathVariable int number) {
        return number * number;
    }
}
